home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Headers / misckit / MiscMergeCommand.h < prev    next >
Encoding:
Text File  |  1995-07-08  |  2.4 KB  |  73 lines

  1. //
  2. //    MiscMergeCommand.h -- abstract class to build merge commands from
  3. //        Written by Don Yacktman Copyright (c) 1995 by Don Yacktman.
  4. //                Version 1.0.  All rights reserved.
  5. //        This notice may not be removed from this source code.
  6. //
  7. //    This object is included in the MiscKit by permission from the author
  8. //    and its use is governed by the MiscKit license, found in the file
  9. //    "LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
  10. //    for a list of all applicable permissions and restrictions.
  11. //    
  12.  
  13.  
  14. // This object is a structure to contain a parsed mail merge command
  15. // and implement a specific command; subclasses should exist for
  16. // each command in the language.
  17.  
  18. #import <appkit/appkit.h>
  19. #import <misckit/miscmerge.h>
  20.  
  21. @interface MiscMergeCommand : Object
  22. {
  23.     // This class is abstract; subclasses will have instance
  24.     // variables to hold parsed arguments, if there are any.
  25. }
  26.  
  27. - initFrom:(MiscString *)aString;  // MUST be a MiscString!
  28.  
  29. // Subclasses must implement the next two methods:
  30.  
  31. // Parse the arguments to the command
  32. - parseFromString:(MiscString *)aString;
  33. // Implementation of the command; a subclass responsibility!
  34. - executeForMerge:(MiscMergeEngine *)aMerger;
  35.  
  36.  
  37.  
  38. /*" Methods to aid in parsing "*/
  39. // All these parsing methods do two things:
  40. // (1) Extract the desired syntactical item from the front of
  41. //     the passed-in string and return it
  42. // (2) Delete said item from the front of the string.
  43.  
  44. // Eats a keyword that is supposed to be there (or optional)
  45. // and returns YES if it found it, NO otherwise
  46. - (BOOL)eatKeyWord:(MiscString *)aKeyWord from:(MiscString *)aString
  47.     isOptional:(BOOL)flag;
  48.  
  49. // gets a string argument, whatever that may be, and returns it
  50. - getArgumentStringFrom:(MiscString *)aString toEnd:(BOOL)endFlag;
  51.  
  52. // gets a prompt, and only a prompt (ie, "?" followed by an argument)
  53. - getPromptFrom:(MiscString *)aString toEnd:(BOOL)endFlag;
  54.  
  55. // Gets either a prompt or a string argument
  56. - getPromptableArgumentStringFrom:(MiscString *)aString
  57.         wasPrompt:(BOOL *)prompt toEnd:(BOOL)endFlag;
  58.  
  59. // Gets some type of condition; see types at the top of this file
  60. - (MISC_Merge_Cond_Op)getConditionalFrom:(MiscString *)aString;
  61.  
  62.  
  63. /*" Errors subclasses may trap "*/
  64. - (void)error_conditional:(MiscString *)theCond;
  65. - (void)error_keyword:(MiscString *)aKeyWord;
  66. - (void)error_noprompt;
  67. - (void)error_closequote;
  68.  
  69. + (BOOL)evaluateConditionWith:(MiscMergeEngine *)anEngine
  70.         for:aCommand;
  71.  
  72. @end
  73.